package org.adit.spring.hibernate.controller;

import java.util.List;

import org.adit.spring.hibernate.component.RouteSession;
import org.adit.spring.hibernate.dao.BuscaDao;
import org.adit.spring.hibernate.dao.PontoDao;
import org.adit.spring.hibernate.dao.RecursoDao;
import org.adit.spring.hibernate.dao.ResourceTypeDao;
import org.adit.spring.hibernate.dao.RouteDao;
import org.adit.spring.hibernate.entity.Ponto;
import org.adit.spring.hibernate.entity.Recurso;
import org.adit.spring.hibernate.entity.ResourceType;
import org.adit.spring.hibernate.entity.Route;

import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Resource;
import br.com.caelum.vraptor.Result;

@Resource
public class IndexController {

	private final BuscaDao buscaDao;
	private final Result result;
	private final PontoDao dao;
	private final RouteDao routeDao;
	private ResourceTypeDao resourceTypeDao;
	private RecursoDao recursoDao;
	private PontoDao pontoDao;
	private RouteSession routeSession;

	public IndexController(PontoDao pontoDao, RecursoDao recursoDao, ResourceTypeDao resourceTypeDao, RouteSession routeSession, BuscaDao buscaDao, PontoDao dao, RouteDao routeDao, Result result) {
		this.pontoDao = pontoDao;
		this.recursoDao = recursoDao;
		this.resourceTypeDao = resourceTypeDao;
		this.routeSession = routeSession;
		this.buscaDao = buscaDao;
		this.dao = dao;
		this.result = result;
		this.routeDao = routeDao;

	}


	@Path("/")
	public void index() {
		
	}
	
	
	@Path("/newRoute")
	public void route() {
		Route route = new Route();
		Long id = routeDao.salva(route);
		System.out.println(id.toString());
		//result.redirectTo(FleetsController.class).enviaXML();

		routeSession.setRoute(route);
	}

}
